﻿<!--

    This file is a part of BinaryDialog.
 
    BiLog IM aka BinaryDialog - WPF Client for XMPP Protocol
    Copyright (C) 2008  Christophe LEMOINE

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see<http://www.gnu.org/licenses/> .

 -->

<Window x:Class="BinaryDialog.Start"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:datas="clr-namespace:BinaryDialog.Datas"
    xmlns:relations="clr-namespace:BinaryDialog.Core.Relationship"
    Title="{StaticResource StartWindowTitle}" Height="431" Width="380" Icon="/BiLog;component/Icons/logo.ico" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" SizeToContent="Height" Background="AliceBlue" Name="StartWindow" Closed="StartWindow_Closed" Closing="StartWindow_Closing">
    
    <Grid>
        
        <TextBlock Name="TextBlock1" Height="21" Margin="8,8,8,0" VerticalAlignment="Top" Text="{StaticResource StartWindowTextBlock1}" FontWeight="Bold" FontSize="14" />
        <TextBlock Name="TextBlock2" Height="21" Margin="16,40,8,0" VerticalAlignment="Top" Text="{StaticResource StartWindowTextBlock2}" />
        
        <StackPanel Background="{StaticResource LowOpacityWhiteBrush}" Margin="0,64,0,0" Orientation="Vertical" VerticalAlignment="Top">
            
            <Separator Margin="0" />
            <Separator Margin="0" Background="Transparent" />
            
            <ListBox SelectionChanged="AccountsList_SelectionChanged" ItemsSource="{Binding ElementName=StartWindow, Path=Accounts}" Name="AccountsList" Style="{StaticResource AccountsList}" Height="140" Margin="0,0,0,1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" IsSynchronizedWithCurrentItem="True">
                <ListBox.Resources>
                    <relations:AccountsConverter x:Key="AccountsConverter" />
                </ListBox.Resources>
            </ListBox>
            
            <Separator Margin="0" Background="Transparent" />
            <Separator Margin="0" />
            
            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="8,0,8,0" Height="24">
                
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.33333*" />
                    <ColumnDefinition Width="0.33333*" />
                    <ColumnDefinition Width="0.33333*" />
                </Grid.ColumnDefinitions>
                
                <Grid.RowDefinitions>
                    <RowDefinition />
                </Grid.RowDefinitions>
                
                <StackPanel Name="HyperLinkNewAccount" Margin="0,0,4,0" Orientation="Horizontal" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" IsEnabled="True">
                    <Image Style="{StaticResource HyperLinkIcon}" Source="/BiLog;component/Icons/book_add.png" Stretch="Fill" Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,4,0" />
                    <TextBlock Name="LinkNewAccount" MouseLeftButtonUp="LinkNewAccount_MouseLeftButtonUp" Style="{StaticResource HyperLink}" Text="{StaticResource StartWindowLinkNewAccountText}" ToolTip="{StaticResource StartWindowLinkNewAccountToolTip}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                </StackPanel>
                
                <StackPanel Name="HyperLinkEditAccount" Margin="0,0,4,0" Orientation="Horizontal" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" IsEnabled="False">
                    <Image Style="{StaticResource HyperLinkIcon}" Source="/BiLog;component/Icons/book_edit.png" Stretch="Fill" Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,4,0" IsEnabled="True" />
                    <TextBlock Name="LinkEditAccount" MouseLeftButtonUp="LinkEditAccount_MouseLeftButtonUp" Style="{StaticResource HyperLink}" Text="{StaticResource StartWindowLinkEditAccountText}" ToolTip="{StaticResource StartWindowLinkEditAccountToolTip}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                </StackPanel>
                
                <StackPanel Name="HyperLinkDeleteAccount" Margin="0,0,4,0" Orientation="Horizontal" Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" IsEnabled="False">
                    <Image Style="{StaticResource HyperLinkIcon}" Source="/BiLog;component/Icons/book_delete.png" Stretch="Fill" Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,4,0" />
                    <TextBlock Name="LinkDeleteAccount" MouseLeftButtonUp="LinkDeleteAccount_MouseLeftButtonUp" Style="{StaticResource HyperLink}" Text="{StaticResource StartWindowLinkDeleteAccountText}" ToolTip="{StaticResource StartWindowLinkDeleteAccountToolTip}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                </StackPanel>
                
            </Grid>
            
            <Separator Margin="0" Background="Transparent" />
            <Separator Margin="0" />
            
        </StackPanel>
        
        <StackPanel Background="Transparent" Margin="0,234,0,8" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Stretch">
            <StackPanel.Triggers>
                
                <EventTrigger RoutedEvent="Expander.Expanded" SourceName="ParamsExpander">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation From="0" To="1" Duration="0:0:0.125" Storyboard.TargetName="ParamsExpanderContent" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleY)"/>
                                <StringAnimationUsingKeyFrames Storyboard.TargetName="ButtonAcceptLabel" Storyboard.TargetProperty="(TextBlock.Text)" Duration="0:0:0.1" FillBehavior="HoldEnd">
                                    <DiscreteStringKeyFrame Value="{StaticResource StartWindowButtonAccept}" KeyTime="0:0:0" />
                                    <DiscreteStringKeyFrame Value="{StaticResource StartWindowButtonAcceptManual}" KeyTime="0:0:0.1" />
                                </StringAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
                <EventTrigger RoutedEvent="Expander.Collapsed" SourceName="ParamsExpander">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation From="1" To="0" Duration="0:0:0.50" Storyboard.TargetName="ParamsExpanderContent" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleY)"/>
                                <StringAnimationUsingKeyFrames Storyboard.TargetName="ButtonAcceptLabel" Storyboard.TargetProperty="(TextBlock.Text)" Duration="0:0:0.1" FillBehavior="HoldEnd">
                                    <DiscreteStringKeyFrame Value="{StaticResource StartWindowButtonAcceptManual}" KeyTime="0:0:0" />
                                    <DiscreteStringKeyFrame Value="{StaticResource StartWindowButtonAccept}" KeyTime="0:0:0.1" />
                                </StringAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
                
                <EventTrigger RoutedEvent="Expander.Expanded" SourceName="AdvancedParamsExpander">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation From="0" To="1" Duration="0:0:0.125" Storyboard.TargetName="AdvancedParamsExpanderContent" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleY)"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
                <EventTrigger RoutedEvent="Expander.Collapsed" SourceName="AdvancedParamsExpander">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation From="1" To="0" Duration="0:0:0.50" Storyboard.TargetName="AdvancedParamsExpanderContent" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleY)"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
                
            </StackPanel.Triggers>
            
            <Expander Name="ParamsExpander" IsExpanded="False" Margin="8,8,8,0" ExpandDirection="Down" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Expander.Header>
                    <TextBlock Margin="4,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{StaticResource StartWindowButtonAcceptManual}" TextTrimming="CharacterEllipsis" Width="170" />
                </Expander.Header>
                <Grid Name="ParamsExpanderContent" Margin="0,8,0,8" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.4*" />
                        <ColumnDefinition Width="0.4*" />
                        <ColumnDefinition Width="0.02*" />
                        <ColumnDefinition Width="0.2*" />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    
                    <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="1" Text="{StaticResource StartWindowInfoServerText}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                    <TextBox Name="InfoId" ToolTip="{StaticResource StartWindowInfoServerToolTip}" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" />
                    <TextBlock Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="1" Text=":" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Center" TextTrimming="CharacterEllipsis" />
                    <TextBox Name="InfoPort" ToolTip="{StaticResource StartWindowInfoPortToolTip}" Grid.Column="3" Grid.Row="0" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Right" />
                    
                    <TextBlock Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="1" Text="{StaticResource StartWindowInfoPasswordText}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                    <PasswordBox Name="InfoPassword" ToolTip="{StaticResource StartWindowInfoPasswordToolTip}" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
                    
                    <CheckBox Name="InfoSSL" ToolTip="{StaticResource StartWindowInfoSSLToolTip}" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="4" Margin="4,4,4,0">
                        <TextBlock Text="{StaticResource StartWindowInfoSSLText}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                    </CheckBox>
                    
                    <CheckBox Name="InfoTLS" ToolTip="{StaticResource StartWindowInfoTLSToolTip}" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="4" Margin="4,4,4,0">
                        <TextBlock Text="{StaticResource StartWindowInfoTLSText}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                    </CheckBox>
                    
                    <CheckBox Name="InfoRegister" ToolTip="{StaticResource StartWindowInfoRegisterToolTip}" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="4" Margin="4,4,4,0">
                        <TextBlock Text="{StaticResource StartWindowInfoRegisterText}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" FontWeight="Bold" />
                    </CheckBox>
                    
                    <Grid.LayoutTransform>
                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                    </Grid.LayoutTransform>
                </Grid>
            </Expander>
            
            <Expander IsExpanded="False" Name="AdvancedParamsExpander" Margin="8,8,8,0" ExpandDirection="Down" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Expander.Header>
                    <TextBlock Margin="4,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{StaticResource StartWindowAdvancedFunctionsText}" TextTrimming="CharacterEllipsis" />
                </Expander.Header>
                <Grid Name="AdvancedParamsExpanderContent" Margin="0,8,0,8" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*" />
                    </Grid.ColumnDefinitions>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    
                    <StackPanel Name="HyperLinkImportAccounts" Margin="4,4,4,0" Orientation="Horizontal" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" IsEnabled="True">
                        <Image Style="{StaticResource HyperLinkIcon}" Source="/BiLog;component/Icons/book_go.png" Stretch="Fill" Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,4,0" />
                        <TextBlock Name="LinkImportAccounts" MouseLeftButtonUp="LinkImportAccounts_MouseLeftButtonUp" Style="{StaticResource HyperLink}" Text="{StaticResource StartWindowImportText}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                    </StackPanel>
                    
                    <StackPanel Name="HyperLinkExportAccounts" Margin="4,4,4,0" Orientation="Horizontal" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" IsEnabled="True">
                        <Image Style="{StaticResource HyperLinkIcon}" Source="/BiLog;component/Icons/book_next.png" Stretch="Fill" Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,4,0" />
                        <TextBlock Name="LinkExportAccounts" MouseLeftButtonUp="LinkExportAccounts_MouseLeftButtonUp" Style="{StaticResource HyperLink}" Text="{StaticResource StartWindowExportText}" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                    </StackPanel>

                    <Grid.LayoutTransform>
                        <ScaleTransform ScaleX="1" ScaleY="0"/>
                    </Grid.LayoutTransform>
                </Grid>
            </Expander>
            
            <StackPanel Background="Transparent" Margin="0,12,0,4" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right">
                
                <Button Height="24" Name="ButtonAccept" IsEnabled="False" Margin="0,8,12,0">
                    <TextBlock Text="{StaticResource StartWindowButtonAccept}" Name="ButtonAcceptLabel" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="8,0,8,0" />
                </Button>
                
            </StackPanel>
            
        </StackPanel>
        
    </Grid>
    
</Window>
